#pragma once

#include <iostream>
#include <string>
#include "XAudio2.h"

struct AStorage
{
	char *FILE;
	WAVEFORMATEXTENSIBLE WFX;
	XAUDIO2_BUFFER BUFFER;
};

class Sound
{
public:
	void Initialize();
	void Shutdown();
	HRESULT FindChunk(HANDLE hFile, DWORD fourcc, DWORD &dwChunkSize, DWORD & dwChunkDataPosition);
	HRESULT ReadChunkData(HANDLE hFile, void * buffer, DWORD buffersize, DWORD bufferoffset);
	HRESULT LoadAudio(char *strFileName);
	HRESULT Play(char * file, UINT32 loop, float volume);

private:
	IXAudio2* pXAudio2;
	IXAudio2MasteringVoice* pMasterVoice;
	AStorage *Storage[5];
	IXAudio2SourceVoice* pSourceVoice;
	int sounds;
};

